package com.vmj.instructions.control;

import com.vmj.instructions.base.NoOperandsInstruction;
import com.vmj.rtda.Frame;

/**
 * Created by yangshoujun on 2017/9/2 下午3:27.
 */
public class IReturn extends NoOperandsInstruction {

    @Override
    public void execute(Frame frame) {
        com.vmj.rtda.Thread thread = frame.getThread();
        Frame currentFrame = thread.popFrame();
        Frame invokerFrame = thread.getCurrentFrame();
        int retVal = currentFrame.getOperandStack().popInt();

        if(frame.getMethod().getName().equals("verifyMemberAccess")) {
            retVal = 1;
        }
        invokerFrame.getOperandStack().pushInt(retVal);
    }
}
